using System;
using System.Globalization;
using System.Windows.Data;

namespace lwd800.Converters
{
    public class ProgressConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Length < 2 || !(values[0] is double currentValue) || !(values[1] is double maxValue))
                return "0 100";

            double progress = currentValue / maxValue;
            double circumference = 2 * Math.PI * 27; // 圆的周长，半径为27（直径60-6)/2
            double dashLength = progress * circumference;
            double gapLength = circumference - dashLength;

            return $"{dashLength} {gapLength}";
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}